﻿Public Module SplashModule
    Public splashGraphics As New FormSplashScreenBackground()
    Public splashText As New FormSplashScreenBackgroundComponents()
End Module

Public Class Main

    Public Shared Sub main(ByVal args() As String)
        SplashModule.splashGraphics.Show()
        SplashModule.splashText.Show()
        Application.DoEvents() ' Ensure the labels of the splashscreen are updated.
        Threading.Thread.Sleep(5000)
        EmbeddedAssembly.preLoad("VisualCrypto.FastRandom.dll", "FastRandom.dll")
        EmbeddedAssembly.preLoad("VisualCrypto.AForge.dll", "AForge.dll")
        EmbeddedAssembly.preLoad("VisualCrypto.AForge.Imaging.dll", "AForge.Imaging.dll")
        EmbeddedAssembly.preLoad("VisualCrypto.AForge.Math.dll", "AForge.Math.dll")
        AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf CurrentDomain_AssemblyResolve
        'Dim splash As New splashscreen()
        Dim running As New Main()
    End Sub

    Private Shared Function CurrentDomain_AssemblyResolve(ByVal sender As Object, ByVal args As ResolveEventArgs) As System.Reflection.Assembly
        Return EmbeddedAssembly.Get(args.Name)
    End Function

    Public Sub New()
        Application.Run(FormMain)
    End Sub

End Class
